﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AnesSystem.Controls.CommonTables.CQ.NTZYY
{
    /// <summary>
    /// ShuHouFangShiCtrl.xaml 的交互逻辑
    /// </summary>
    public partial class ShuHouZhenTongCtrl : CustomCommonTableCtrl
    {
        public ShuHouZhenTongCtrl()
        {
            InitializeComponent();
            SetMzfs();
            this.Loaded += ShuHouZhenTongCtrl_Loaded;

        }


        #region Variables

        #endregion

        #region Constructor

        #endregion

        #region Properties

        #endregion

        #region 依赖属性





        public List<CommonComboboxItemModel> PingFenList
        {
            get { return (List<CommonComboboxItemModel>)GetValue(PingFenListProperty); }
            set { SetValue(PingFenListProperty, value); }
        }

        // Using a DependencyProperty as the backing store for PingFenList.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty PingFenListProperty =
            DependencyProperty.Register("PingFenList", typeof(List<CommonComboboxItemModel>), typeof(ShuHouZhenTongCtrl), new PropertyMetadata(null));



        public List<CommonComboboxItemModel> QiTaList
        {
            get { return (List<CommonComboboxItemModel>)GetValue(QiTaListProperty); }
            set { SetValue(QiTaListProperty, value); }
        }

        // Using a DependencyProperty as the backing store for QiTaList.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty QiTaListProperty =
            DependencyProperty.Register("QiTaList", typeof(List<CommonComboboxItemModel>), typeof(ShuHouZhenTongCtrl), new PropertyMetadata(null));



        public List<CommonComboboxItemModel> ZjPingList
        {
            get { return (List<CommonComboboxItemModel>)GetValue(ZjPingListProperty); }
            set { SetValue(ZjPingListProperty, value); }
        }

        // Using a DependencyProperty as the backing store for ZjPingList.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty ZjPingListProperty =
            DependencyProperty.Register("ZjPingList", typeof(List<CommonComboboxItemModel>), typeof(ShuHouZhenTongCtrl), new PropertyMetadata(null));



        #endregion

        #region Event

        #endregion

        #region Private Methods
        private void SetMzfs()
        {
            if (DataManager.Instance.CurrentPatientLink == null) return;
            string mzfs = DataManager.Instance.CurrentPatientLink.AnesthesiaRecord.Mzff;
            if (!string.IsNullOrEmpty(mzfs))
            {
                if (mzfs.Contains("复合麻醉"))
                {
                    fhmz.Value = true;

                }
                else
                {
                    if (mzfs.Contains("椎管内麻醉"))
                    {
                        zgnmz.Value = true;

                    }
                    else if (mzfs.Contains("神经阻滞麻醉"))
                    {
                        sjzzmz.Value = true;

                    }
                    else if (mzfs.Contains("气管插管全麻"))
                    {
                        qm.IsChecked = true;

                    }
                    else if (mzfs.Contains("局麻"))
                    {
                        jm.IsChecked = true;

                    }
                }

            }
        }

        #endregion

        #region Public/Protected Methods

        #endregion

        #region EventHandlers

        private void ShuHouZhenTongCtrl_Loaded(object sender, RoutedEventArgs e)
        {
            DataManager.Instance.IsNotNeedSaveData = false;
        }

        #endregion

        private void ztkssj_GotFocus(object sender, RoutedEventArgs e)
        {
            CusDatePickerWin cusDatePicker = new CusDatePickerWin();
            cusDatePicker.SelectedDateTime = DateTime.Now;
            cusDatePicker.ShowDialog();
            if (cusDatePicker.Result)
            {
                ztkssj.Value = cusDatePicker.SelectedDateTime.ToString(DateFormat.DATE_FORMAT_STR_YMDHM_CN);//2005年11月5日
            }
        }

        private void sj1_GotFocus(object sender, RoutedEventArgs e)
        {
            try
            {
                CustomTextCtrl textCtrl = sender as CustomTextCtrl;
                CusDatePickerWin cusDatePicker = new CusDatePickerWin();
                cusDatePicker.SelectedDateTime = DateTime.Now;
                cusDatePicker.ShowDialog();
                if (cusDatePicker.Result)
                {
                    textCtrl.Value = cusDatePicker.SelectedDateTime.ToString(DateFormat.DATE_FORMAT_STR_YMDHM);//2005-11-5 
                }
            }
            catch
            {

            }

        }
    }
}
